//using System;
//using Adoor.Object;
//using Adoor.Object.Relational;
//using System.Collections.Generic;
//using Adoor.Relational;

//namespace Adoor
//{
//#if !OLDAdoor
//    public class ObjectDomain
//    {
//        protected static log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);		

//        private ObjectDomain()
//        {
//        }

//        static ObjectDomain()
//        {
//        }

//        private static Hashtable htDomains = new Hashtable();

//        private static Adoor.Object.Domain.ObjectDomain current;
//            //new Adoor.Object.ObjectDomain(typeof(ObjectDomain).Assembly, "Adoor.EmptyMapping.xml", null, "root");

//        public static Adoor.Object.Domain.ObjectDomain Current
//        {
//            get
//            {				
//                if(current == null)
//                {
//                    current = new Adoor.Object.Domain.ObjectDomain(null);
//                    current.Name = "Root";
//                    current.AssemblyName = "Adoor";
//                    current.MapFileName = "Adoor#Adoor.EmptyMapping.xml";
//                    current.RootDomain = current;
//                }
//                return current;
//            }
////			set
////			{
////				current = value;				
////			}
//        }

//        public static void ClearObjectDomain()
//        {
//            htDomains = new Hashtable();
//            current = null;
//            Adoor.Object.Domain.ObjectDomain.ClearDomains();
//        }

//        public static Adoor.Object.Domain.ObjectDomain AddObjectDomain(System.Reflection.Assembly assembly, string resourceName, IDictionary extendedProperties)
//        {
//            System.Diagnostics.Debug.Assert(assembly.GetManifestResourceStream(resourceName) != null);
			
//            if(!htDomains.Contains(assembly.FullName))
//            {
//                Adoor.Object.Domain.ObjectDomain domain = new Adoor.Object.Domain.ObjectDomain(Current);
//                domain.AssemblyName = assembly.GetName().Name;
//                domain.MapFileName = string.Concat(domain.AssemblyName, "#", resourceName);
//                domain.Name = domain.AssemblyName;
//                AddDomain(domain, assembly.FullName);
//                addDomainReferences(domain, assembly, resourceName, extendedProperties);
//                return domain;
//            }
//            return null;
//        }

//        public static Adoor.Object.Domain.ObjectDomain AddObjectDomain(string domainName, string fileName, IDictionary extendedProperties)
//        {
//            Adoor.Object.Domain.ObjectDomain domain = new Adoor.Object.Domain.ObjectDomain(Current);
//            domain.AssemblyName = "";
//            domain.MapFileName = fileName;
//            domain.Name = domainName;
//            AddDomain(domain, domainName);
//            return domain;
//        }

////		private static IObjectDomain ObjectDomain_ObjectDomainResolve(object sender, ObjectDomainEventArgs e)
////		{
////			return htDomains[e.AssemblyName.FullName] as Adoor.Object.IObjectDomain;
////		}
////
////		private static void ObjectDomain_ObjectDomainCreated(object sender, ObjectDomainEventArgs e)
////		{
////			AddDomain(e.Domain, e.AssemblyName.FullName);
////		}

//        private static void AddDomain(Adoor.Object.Domain.ObjectDomain domain, string fullName)
//        {
//            log.Debug("Added Domain " + fullName);
//            htDomains.Add(fullName, domain);
//            current.References.Add(domain);
//        }

//        private static void addDomainReferences(Adoor.Object.Domain.ObjectDomain parent, System.Reflection.Assembly assembly, string resourceName, IDictionary extendedProperties)
//        {			
//            foreach (System.Reflection.AssemblyName assemblyName in assembly.GetReferencedAssemblies())
//            {
//                System.Reflection.Assembly assemblyRef = System.Reflection.Assembly.Load(assemblyName);
//                string newResourceName = resourceName;
//                if (newResourceName.StartsWith(assembly.GetName().Name))
//                    newResourceName = assemblyRef.GetName().Name + newResourceName.Substring(assembly.GetName().Name.Length);

//                Adoor.Object.Domain.ObjectDomain reference = htDomains[assemblyName.FullName] as Adoor.Object.Domain.ObjectDomain;

//                if(reference == null)
//                {
//                    System.IO.Stream s = assemblyRef.GetManifestResourceStream(newResourceName);
//                    if (s != null) 
//                    {
//                        reference = AddObjectDomain(assemblyRef, newResourceName, extendedProperties);
//                        if(reference != null)
//                            parent.References.Add(reference);
////						reference = new Adoor.Object.Domain.ObjectDomain();
////						reference.AssemblyName = assemblyName.Name;
////						reference.MapFileName = string.Concat(reference.AssemblyName, "#", newResourceName);
////						reference.Name = reference.AssemblyName;
////						
////						parent.References.Add(reference);
////						AddDomain(reference, assemblyName.FullName);
//                    }
//                }
//                else
//                    parent.References.Add(reference);
//            }
//        }
//    }

	

//    public enum CloneMode
//    {
//        Empty = 0 ,
//        NewData ,
//        Full,
//        NoData 
//    }
//#endif
//}